class Admin::AppQuestionsController < ApplicationController
  layout "admin"

  helper :button

  before_filter :login_required

  access_control :DEFAULT => 'admin | app_questions'

  resource_this :will_paginate => true, :path_prefix => 'admin_'

  def sort
    @questions = AppQuestion.find(:all)
    AppQuestion.transaction do 
      @questions.each do |question|
        question.position = params[:question_list].index(question.id.to_s)+1
        question.save
      end
    end
  end

  def load_app_questions
    @app_questions = AppQuestion.find(:all, :order => :position)
  end

end
